﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="weikeweixin.web.wechat.vip.index" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>会员卡</title>
    <meta content="width=device-width, initial-scale=1.0, user-scalable=no" name="viewport" />
    <meta name="format-detection" content="telephone=no" />
    <link href="../all/css/card.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/Scripts/JQuery.min.js"></script>
    <script type="text/javascript" src="/Scripts/Su.common.js"></script>
    <style type="text/css">
        .masklayer
        {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            z-index: 2000;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.5);
            text-align: right;
        }
        .masklayer.on
        {
            display: none;
        }
        .masklayer img
        {
            margin-top: 10px;
            margin-right: 30px;
            width: 180px;
        }
    </style>
    <script type="text/javascript">
        var wxid = getQueryString("wxid");
        var uid = getQueryString("uid");
        var ActionUrl = "index.aspx?wxid=" + wxid + "&uid=" + uid;
        var InfoUrl = "information.aspx?wxid=" + wxid + "&uid=" + uid;
        var NoteUrl = "note.aspx?wxid=" + wxid + "&uid=" + uid;
        var ShopsUrl = "shops.aspx?wxid=" + wxid + "&uid=" + uid;
        var ExplainUrl = "explain.aspx?wxid=" + wxid + "&uid=" + uid;
        var ordUrl = "ord.aspx?wxid=" + wxid + "&uid=" + uid;
        var SignUpUrl = "SignUp.aspx?wxid=" + wxid + "&uid=" + uid;
        var Month = new Date().getMonth() + 1;
        var SignInurl = "qiandao.aspx?wxid=" + wxid + "&uid=" + uid + "&Month=" + Month;
        var Privilegeurl = "privilege.aspx?wxid=" + wxid + "&uid=" + uid;
        var Couponurl = "coupan.aspx?wxid=" + wxid + "&uid=" + uid + "&Month=" + Month;
        var Gifturl = "giftlist.aspx?wxid=" + wxid + "&uid=" + uid;
        var Pay1url = "cardshop.aspx?wxid=" + wxid + "&uid=" + uid;
        var Inter1url = "signin.aspx?wxid=" + wxid + "&uid=" + uid + "&Month=" + Month;
        if (getQueryString("hid") != null) {
            ActionUrl = "index.aspx?wxid=" + wxid + "&uid=" + uid + "&hid=" + getQueryString("hid");
        }
    </script>
</head>
<body id="card" ondragstart="return false;" onselectstart="return false;">
    <section class="body">
        <div id="overlay" style="position: fixed; z-index: 100;">
        </div>
        <div class="cardcenter">
            <%if (dtvip.Rows.Count == 0)
              {%>
            <div class="msk">
                <p class="explain2">
                <%if (!string.IsNullOrEmpty(Request.QueryString["hid"]))
                  { %>
                  <a id="showcard"  class="receive" href="javascript:void(0)">点击填表</a> <span>填写信息即可领奖</span>
                  <%}
                  else
                  { %>
                    <a id="showcard"  class="receive" href="javascript:void(0)">领取您的新会员卡</a> <span>微时代会员卡，方便携带收藏，永不挂失</span><%} %>
                </p>
            </div>
            <%}%>
            <div class="card">
                <img class="cardbg" src="<%=cardset_bgpic %>"/>
                <%if (!string.IsNullOrEmpty(cardsetmodel.cardset_logo))
                  { %>
                <img id="cardlogo" class="logo" src="<%=cardsetmodel.cardset_logo %>"/>
                <%} %>
                <h1 style="color:<%=cardsetmodel.cardset_namecolor %>"> <%=cardsetmodel.cardset_name %></h1>
                <strong class="pdo verify" style="color:<%=cardsetmodel.cardset_codecolor %>" ><span id="cdnb" style="text-align: right;
                    margin-top: 10px;"><%=vipmodel.vip_name %><p>ID: <%=vipmodel.vip_code %></p></span> </strong>
            </div>
            <p class="explain">
                <span>使用时向服务员出示此卡</span>
            </p>
        </div>

    <%if (dtvip.Rows.Count > 0)
      {%>
        <div id="list" class="cardexplain">
        <!--会员积分信息-->
    <div class="jifen-box">
        <ul class="zongjifen">
            <li>
                <a id="Payw1" href="oa_shoplist.aspx?uid=<%=Request.QueryString["uid"] %>&wxid=<%=Request.QueryString["wxid"]%>">
                    <div class="#">
                        <p>消费积分</p>
                        <span>0分</span>
                    </div>
                </a>
            </li>
            <li>
                <a id="interw1" href="oa_shoplist.aspx?uid=<%=Request.QueryString["uid"] %>&wxid=<%=Request.QueryString["wxid"]%>">
                    <div class="fengexian">
                        <p>剩余积分</p>
                        <span>0分</span>
                    </div>
                </a>
            </li>
            <li>
                <a  href="../party/ordlist.aspx?uid=<%=Request.QueryString["uid"] %>&wxid=<%=Request.QueryString["wxid"]%>">
                    <p>积分兑换</p>
                    <span></span>
                </a>
            </li>
        </ul>
        <div class="clr"></div>
    </div>    <%} %>
                   
 
            <ul class="round">
                
                <%if (dtvip.Rows.Count > 0){%>
                <li  id="coupon1"><a id="explain" href="javascript:void()"><span>会员说明</span></a></li>
                </ul>
            <ul class="round">
<%--                <li id="signin1"  ><a  href="/web/wechat/vip/guest.aspx?uid=<%=Request.QueryString["uid"] %>&wxid=<%=Request.QueryString["wxid"]%>"><span>我要贷款</span></a></li>
                <li id="Li1"  ><a  href="/web/wechat/vip/guest.aspx?uid=<%=Request.QueryString["uid"] %>&wxid=<%=Request.QueryString["wxid"]%>"><span>我要贷款</span></a></li>
                <li id="Li2"  ><a  href="/web/wechat/vip/guest.aspx?uid=<%=Request.QueryString["uid"] %>&wxid=<%=Request.QueryString["wxid"]%>"><span>我要贷款</span></a></li>--%>
                <li id="Li1"  ><a  href="/web/wechat/vip/ord.aspx?uid=<%=Request.QueryString["uid"] %>&wxid=<%=Request.QueryString["wxid"]%>"><span>预约服务</span></a></li>
                <li id="Li3"  ><a  href="/web/wechat/vip/coupanlist.aspx?uid=<%=Request.QueryString["uid"] %>&wxid=<%=Request.QueryString["wxid"]%>"><span>代金券</span></a></li>
                <li id="Li4"  ><a  href="/web/wechat/party/ordlist.aspx?uid=<%=Request.QueryString["uid"] %>&wxid=<%=Request.QueryString["wxid"]%>"><span>推荐服务</span></a></li>
                <li id="Li5"  ><a  href="/web/wechat/vip/guest.aspx?uid=<%=Request.QueryString["uid"] %>&wxid=<%=Request.QueryString["wxid"]%>"><span>信息反馈</span></a></li>
                 <%} %>
                
            </ul>
            <ul class="round">
            <li><a id="A2" href="tel:<%=explainmodel.explain_phone%>"><span>电话：<%=explainmodel.explain_phone%></span></a></li>
            <li><a id="A1" href="javascript:void()"><span>地址：<%=explainmodel.explain_address%></span></a></li>
            </ul>
           
        </div>
        <div class="plugback">
            <a href="javascript:history.back(-1)">
                <div class="plugbg themeStyle">
                    <span class="plugback"></span>
                </div>
            </a>
        </div>
        <!--输入框-->
        <div class="window" id="windowcenter" style="height: auto!important; max-height: 1000px!important;
            bottom: inherit!important;">
            <div id="title" class="wtitle">      
                                  领卡信息<span class="close" id="alertclose"></span>
                                  </div>
           
            <div class="content">
                <div id="txt">
                    填写真实的信息，即可获得会员卡，享受会员特权。</div>
                <script type="text/javascript">
                    var navg = navigator.userAgent.toLowerCase(), html = '';
                    if (navg.match(/(ipad)|(iphone)/i)) {
                        html = '<p>\
								    <input name="VIP_Name" value="" class="px" id="VIP_Name" type="text" placeholder="请输入您的姓名" ontouchstart="event.preventDefault();this.focus();this.select();" />\
							    </p>\
                                <p>\
								    <input name="VIP_Phone" class="px"  id="VIP_Phone" value="" type="tel" placeholder="请输入您的电话" ontouchstart="event.preventDefault();this.focus();this.select();" />\
								</p>\
                                <p>\
								    <input name="check" class="px" style="width: 134px;float: left;height: 36px;"  id="check" value="" type="tel" placeholder="请输入验证码" ontouchstart="event.preventDefault();this.focus();this.select();" /><input type="button" value="获取验证码" style="width: 97px;float: right;height: 37px;background-color: teal;" class="px">\
								</p>';

                        html += '<div id="ExField" style="display:none;">'
                        html += '</div>'
                    } else {
                        html = '<p>\
								    <input name="VIP_Name" value="" class="px" id="VIP_Name" type="text" placeholder="请输入您的姓名" />\
							    </p>\
							    <p>\
								    <input name="VIP_Phone" class="px"  id="VIP_Phone" value="" type="tel" placeholder="请输入您的电话" />\
								</p>\
                                <p>\
								    <input name="check" class="px" style="width: 134px;float: left;height: 36px;" id="check" value="" type="tel" placeholder="请输入验证码" /><input type="button" value="获取验证码" style="width: 97px;float: right;height: 37px;background-color: teal;" class="px">\
								</p>';

                        html += '<div id="ExField" style="display:none;">'
                        
                        html += '</div>'
                    }

                    document.write(html);
                </script>
                <input type="button"  value="确 定" name="确 定" class="txtbtn" id="windowclosebutton"/>
             </div>
        </div>
        <!---->
    </section>
    <div class="masklayer on" ontouchmove="return true;">
        <img src="../all/images/instruction.png" />
    </div>
</body>
</html>
<script type="text/javascript">
    $(document).ready(function () {
        $("#info").attr("href", InfoUrl);
        $("#vipnote").attr("href", NoteUrl);
        $("#explain").attr("href", ExplainUrl);
        $("#shops").attr("href", ShopsUrl);
        $("#ordUrl").attr("href", ordUrl);
        $("#signin").attr("href", SignInurl);
        $("#privilege").attr("href", Privilegeurl);
        $("#coupon").attr("href", Couponurl);
        $("#gift").attr("href", Gifturl);
        $("#Pay1").attr("href", Pay1url);
        $("#Pay2").attr("href", Pay1url);
        $("#inter1").attr("href", Inter1url);

        $("#windowclosebutton").click(function () {
            var VIP_Phone = $("#VIP_Phone").val();
            var VIP_Name = $("#VIP_Name").val();
            if (VIP_Name == '' || "请输入名字!" == VIP_Name) {
                $("#txt").html('<span style="color:red;">' + "请输入名字!" + '</span>');
                return;
            }

            if (VIP_Phone == '' || "手机号不对或为空!" == VIP_Phone) {
                $("#txt").html('<span style="color:red;">' + "手机号不对或为空!" + '</span>');
                return;
            }
            $.ajax({
                url: ActionUrl + "&action=bindvip",
                type: "post",
                data: { phone: VIP_Phone, name: VIP_Name },
                success: function (data) {
                    data = eval("(" + data + ")");

                    if (data.error == 200) {
                        window.location.href = ActionUrl;
                    } else if (data.error == 100) {
                        window.location.href = "/web/wechat/guaguaka/guaguaka.aspx?wxid=" + wxid + "&uid=" + uid+"&hid="+getQueryString("hid");
                    } else {
                        $("#txt").html('<span style="color:red;">' + data.error + '</span>');
                    }
                }
            });
        });

        $("#showcard").click(function () {
            alert("填写真实的信息，即可获得会员卡，享受会员特权。");
            $("#overlay").css("display", "block");
        });
    });

    $("#alertclose").click(function () {
        $("#windowcenter").slideUp(500);
        $("#overlay").css("display", "none");
    });

    $("#nextstep").click(function () {
        var VIP_Phone = $("#VIP_Phone").val();
        var VIP_Name = $("#VIP_Name").val();

        if (VIP_Name == '' || "请输入名字!" == VIP_Name) {
            $("#txt").html('<span style="color:red;">' + "请输入名字!" + '</span>');
            return;
        }

        if (VIP_Phone == '' || "手机号不对或为空!" == VIP_Phone) {
            $("#txt").html('<span style="color:red;">' + "手机号不对或为空!" + '</span>');
            return;
        }

        if (!IsPhone) {
            return;
        }

        $("#nextstep").css("display", "none");
        $("#VIP_Name").css("display", "none");
        $("#VIP_Phone").css("display", "none");
        $("#ExField").css("display", "block");
        $("#windowclosebutton").css("display", "block");
    });

    function alert(title) {
        $("#windowcenter").slideToggle("slow");
        $("#txt").html(title);
    }

    $(function () {
        if (window.location.href.indexOf("is_share") > 0) {
            $('.masklayer').show();
        }

        var onBridgeReady = function () {
            var appId = '';
            var imgUrl = '<%=cardsetmodel.cardset_bgpic %>';

            if (window.location.href.indexOf("is_share") > 0) {
                var link = window.location.href;
            } else {
                var link = window.location.href + "&is_share=1";
            }

            var title = '<%=cardsetmodel.cardset_name %>';
            var desc = '微时代会员卡，方便携带收藏，永不挂失 ';
            desc = desc || link;

            //发送给好友; 
            WeixinJSBridge.on('menu:share:appmessage', function (argv) {
                WeixinJSBridge.invoke('sendAppMessage', {
                    "appid": appId,
                    "img_url": imgUrl,
                    "img_width": "640",
                    "img_height": "640",
                    "link": link,
                    "desc": desc,
                    "title": title
                }, function (res) { });
            });
            //分享到朋友圈;
            WeixinJSBridge.on('menu:share:timeline', function (argv) {
                WeixinJSBridge.invoke('shareTimeline', {
                    "img_url": imgUrl,
                    "img_width": "640",
                    "img_height": "640",
                    "link": link,
                    "desc": desc,
                    "title": title
                }, function (res) { });
            });
            // 分享到微博;
            var weiboContent = '';
            WeixinJSBridge.on('menu:share:weibo', function (argv) {
                WeixinJSBridge.invoke('shareWeibo', {
                    "content": title + link,
                    "url": link
                }, function (res) { });
            });
            // 分享到Facebook
            WeixinJSBridge.on('menu:share:facebook', function (argv) {
                WeixinJSBridge.invoke('shareFB', {
                    "img_url": imgUrl,
                    "img_width": "640",
                    "img_height": "640",
                    "link": link,
                    "desc": desc,
                    "title": title
                }, function (res) { });
            });
        }

        if (document.addEventListener) {
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        } else if (document.attachEvent) {
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    });
</script>
